package com.ddx.dao;

import com.ddx.pojo.ShoppingUserAddress;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ShoppingUserAddressMapper {
    int deleteByPrimaryKey(Long id);

    int insert(ShoppingUserAddress record);

    int insertSelective(ShoppingUserAddress record);

    ShoppingUserAddress selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ShoppingUserAddress record);

    int updateByPrimaryKey(ShoppingUserAddress record);
    //@LZ_TAG_ID: METHOD BEGIN 自定义方法

    /**
     * 修改用户默认收货地址
     * @param id
     * @return
     */
    int updateDefaultByUserId(Long id);

    /**
     * 将用户默认收货地址修改为非默认
     * @param userId
     * @return
     */
    int updateUserDefault(String userId);

    /**
     * 根据用户id查询用户收货地址
     * @param userId
     * @return
     */
    List<ShoppingUserAddress> selectAdressByUserId(String userId);

    List<ShoppingUserAddress> selectByRecord(ShoppingUserAddress record);

    ShoppingUserAddress getDefaultAddress(@Param("userId") String userId);
    //@LZ_TAG_ID: METHOD END
}